<link rel="shortcut icon" href="<?php echo base_url() ?>static/images/logoTelkomsel-favico.png" />
<link href="<?php echo base_url() ?>static/css/bootstrap.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/select2/select2-bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/jquery.datetimepicker.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/js/Metro-UI-CSS/min/iconFont.min.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/print.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery-excel-export/jquery.btechco.excelexport.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery-excel-export/jquery.base64.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery.printElement.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>static/js/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/form.js"></script>

<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>

<script>
    function appManagerSave() {
            $.post("<?= site_url() ?>search_global/app_mgrSave", {
                pCTab: $('#pCTab').val(),
                pCType: $('#pCType').val(),
                pCtrlID: $('#pCtrlID').val(),
                pApproval: $('#pApproval').val(),
                pNikRequestBy: $('#pNikRequestBy').val(),
                pComment: $('#pComment').val(),
                //pAccesNo: $('#pAccesNo').val()
            },
            function(data) {
                window.location = '<?php echo base_url(); ?>search_global';
            }
            );
        }
    function cancel(){
        window.location = '<?php echo base_url(); ?>search_global';
    }
</script>

<?php
    $this->load->model('sGlobal_model');
    
    foreach ($getDetail as $z) {
        $zSdate   		   = $z["SO_SDATE"];
    	$zEdate   		   = $z["SO_EDATE"];
    	$zShours   		   = $z["SO_SHOURS"];
    	$zEhours   		   = $z["SO_EHOURS"];
    	$zShoure   		   = $z["SO_SHOURE"];
    	$zEhoure   		   = $z["SO_EHOURE"];
    	$zDescription      = $z["SO_DESCRIPTION"];
    	$zAc   			   = $z["SO_AC"];
    	$zLift   		   = $z["SO_LIFT"];
    	$zLighting   	   = $z["SO_LIGHTING"];
    	$zOther   		   = $z["SO_OTHER"];
    	$zOtherDescription = $z["SO_OTHER_DESCRIPTION"];
    	$zAtasanNik   		= $z["SO_ATASAN_NIK"];
    	$zUntukNik   		= $z["SO_UNTUK_NIK"];
    	$zAtasanNama   		= $this->sGlobal_model->getName($zAtasanNik);
    
    	$cName				= $this->sGlobal_model->getName($zUntukNik); 
    	$cJob				= $this->sGlobal_model->getJobPosition($zUntukNik);
    	$cOrg				= $this->sGlobal_model->getOrg($zUntukNik);
    
    	$aNik				= $z["SO_NIP"];
    	$aName				= $this->sGlobal_model->getName($aNik); 
    	$aJob				= $this->sGlobal_model->getJobPosition($aNik); 
    	$aOrg				= $this->sGlobal_model->getOrg($aNik); 


		if($zAc == 'Y'){
		   $vAc= "checked";
		}

		if($zLift == 'Y'){
		   $vLift= "checked";
		}

		if($zLighting == 'Y'){
		   $vLighting= "checked";
		}

		if($zOther == 'Y'){
		   $vOther= "checked";
		}
        //NANTI DULU
        //if(empty($sesOrg)){
   		//   $org = dbora_getorg("$nik");
    	//}
    }
    
?>




<form id="formarea" role="form" method="post" action="#">
<input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
    <input type="hidden" value="<?php echo $cTab; ?>" id="pCTab" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
    <input type="hidden" value="<?php echo $aNik;?>" id="pNikRequestBy" name="pNikRequestBy"/>

<div class="col-md-offset-0" id="top">
    <div class="col-md-11">
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Request By</b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">NIK</label>
    						<div class="col-md-9" id="pNik"><?php echo $aNik;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9" id="nik"><?php echo $aName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $aOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $aJob;?></div>
				        </div>
                    </div>                   
                </div>
                
            </div>
        </div>
        
        
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Requestor </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nik</label>
                            <div class="col-md-3">
                                <input type="text" value="<?php echo $zUntukNik;?>" id="r_id" class="form-control input-sm" readonly=""/>
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-6">
                            <input type="text" class="form-control input-sm" id="r_nama" value="<?php echo $cName;?>" readonly=""/>
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama Atasan</label>
    						<div class="col-md-6">
                            <input id="r_mgrid"  type="hidden" value="<?php echo $zAtasanNik;?>" />
                            <input id="r_mgr"  type="text" value="<?php echo $zAtasanNama;?>" readonly=""class="form-control input-sm"/>
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Department</label>
    						<div class="col-md-6">
                            <input type="text" class="form-control input-sm" id="r_dept" value="<?php echo $cOrg;?>" readonly=""/>
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Job Position</label>
    						<div class="col-md-6">
                            <input type="text" class="form-control input-sm" id="r_job" value="<?php echo $cJob;?>" readonly=""/>
                            </div>
				        </div>
                    </div>                   
                </div>
                
                
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Tanggal Overtime</label>
    						<div class="col-sm-3 form-group ">
									<div class="input-group">
										<span class="input-group-addon">From</span>
										<input type="text" class="form-control text-center input-sm" name="date_start" id="datepicker1" value="<?php echo $zSdate; ?>" readonly=""/>
									</div>
								
							</div>
							<div class="col-sm-3 form-group ">
									<div class="input-group">
										<span class="input-group-addon">To</span>
										<input type="text" class="form-control text-center input-sm" name="date_end" id="datepicker2" value="<?php echo $zEdate; ?>" readonly=""/>
									</div>
							</div>   
				        </div>
                    </div>                   
                </div>
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Jam Overtime</label>
    						<div class="col-md-2"><input type="text" class="form-control input-sm" id="pShour" value="<?php echo $zShours;?>" readonly=""/></div>
                            <div class="col-md-2"><input type="text" class="form-control input-sm" id="pSminute" value="<?php echo $zEhours;?>" readonly=""/></div>
                            <div class="col-md-2"><input type="text" class="form-control input-sm" id="pEhour" value="<?php echo $zShoure;?>" readonly=""/></div>
                            <div class="col-md-2"><input type="text" class="form-control input-sm" id="pEminute" value="<?php echo $zEhoure; ?>" readonly=""/></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
    						<div class="col-md-9">
                            <?php 
                            echo "Waktu lembur senin-jumat jam 18:00, sabtu mulai jam 13:00, minggu all day";
                            ?>
                            </div>
				        </div>
                    </div>                   
                </div>
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Facility</label>
    						<div class="col-md-3">
                                <input id="pAc" type="checkbox" value="Y" <?php if($zAc == 'Y'){?>checked=""<?php }?> disabled=""/>&nbsp;&nbsp;Air Conditioner
                            </div>
                            <div class="col-md-3">
                                <input id="pLift" type="checkbox" value="Y"  <?php if($zLift == 'Y'){?>checked=""<?php }?> disabled=""/>&nbsp;&nbsp;Service Lift
                            </div>
                            <div class="col-md-3">
                                <input id="pLighting" type="checkbox" value="Y"  <?php if($zLighting == 'Y'){?>checked=""<?php }?>  disabled=""/>&nbsp;&nbsp;Lighting &amp; Power
                            </div>
				        </div>
                    </div>                   
                </div>
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Description</label>
    						<div class="col-md-4">
                                <textarea class="form-control input-sm" id="pDescription" readonly=""><?php echo $zDescription;?></textarea>
    						</div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Approval</label>
    						<div class="col-md-4">
                                <select class="form-control input-form select2" id="pApproval" style="width:100%">
                            			<option value="Y">Approve</option>
                                        <option value="N" selected="">Disapprove</option>
    				            </select>
    						</div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                
                <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
                                    <thead>
                                        <tr>
                                            <th class="tblhead" style="width:5%;text-align:center;">No</th>
                                            <th class="tblhead" style="width:20%;text-align:center;">Nama</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Lantai</th>
                                            <th class="tblhead" style="width:20%;text-align:center;">Location</th>
                                            <th class="tblhead" style="width:45%;text-align:center;">Company Name</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $i=0;
										$no=1;
                                        foreach ($getDetailVendor as $b) {
                                                    $bSodId   		= $b["SOD_ID"];
													$bSodName   	= $b["SOD_NAME"];
													$bSodFloor   	= $b["SOD_FLOOR"];
													$bSodLocation   = $b["SOD_LOCATION"];
													$bSodVendorId   = $b["SOD_VENDOR_ID"];
													$bSodVendorName = $b["SOD_VENDOR_NAME"];
													$bSoId   		= $b["SO_ID"];
                                            ?>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo $i+1; ?>
                                                <input class="form-control input-sm" type="hidden" id="pSodId<?php echo $i;?>" value="<?php echo $bSodId;?>"/>
                                            </td>
                                            <td style="font-size:10px;"><?php echo $bSodName;?></td>
                                            <td style="font-size:10px;"><?php echo $bSodFloor; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodLocation; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodVendorName; ?></td>
                                        </tr>
                                        <?php
                                        $i++;
                                        $no++;
                                        }
                                        ?>
                                        
                                        <input type="hidden" id="jumlahVendor" value="<?php echo $i;?>"/>
                                    </tbody>
                                </table>
                </div>
                
                
                
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
        						<div class="col-sm-2">
                                    <button type="button" class="btn btn-primary btn-block" onclick="appManagerSave();">Submit</button>
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                                </div>
    				        </div>
                        </div>                   
                    </div>
            </div>
        </div>
        
    </div>
</div>
</form>


